[typespec-java] flatten typespec-java, cleanup autorest related code#4721
[typespec-java] flatten typespec-java, cleanup autorest related code#4721XiaofeiCao wants to merge 31 commits into
Conversation
|
All changed packages have been documented.
Show changes
|
⚡ Benchmark Results
Full details – comparing
|
| Metric | Baseline | Current | Change |
|---|---|---|---|
| total | 🔴 877.2ms | 🔴 1.07s | +21.6% 🔴 |
| loader | 🟡 259.8ms | 🟡 328.0ms | +26.3% 🔴 |
| resolver | 🟢 33.0ms | 🟢 41.0ms | +24.4% 🔴 |
| checker | 🟡 309.9ms | 🟡 383.9ms | +23.9% 🔴 |
| validation | 🟢 72.0ms | 🟢 87.9ms | +22.1% 🔴 |
| ↳ validation/@azure-tools/typespec-azure-core | 🟡 10.5ms | 🟡 13.4ms | +27.7% 🔴 |
| ↳ validation/@typespec/http | 🟡 12.2ms | 🟡 16.3ms | +33.3% 🔴 |
| ↳ validation/@typespec/rest | 🟢 1.3ms | 🟢 1.7ms | +32.7% |
| ↳ validation/@typespec/versioning | 🔴 44.7ms | 🔴 52.5ms | +17.5% 🔴 |
| ↳ validation/compiler | 🟢 3.2ms | 🟢 4.0ms | +24.8% |
| linter | 🟢 187.4ms | 🟡 225.1ms | +20.1% 🔴 |
| ↳ linter/@azure-tools/typespec-azure-core/auth-required | 🟢 0.1ms | 🟢 0.1ms | +48.6% |
| ↳ linter/@azure-tools/typespec-azure-core/bad-record-type | 🟢 0.5ms | 🟢 0.6ms | +25.2% |
| ↳ linter/@azure-tools/typespec-azure-core/byos | 🟢 7.4ms | 🟢 8.7ms | +16.6% 🔴 |
| ↳ linter/@azure-tools/typespec-azure-core/casing-style | 🟢 1.2ms | 🟢 1.5ms | +25.2% |
| ↳ linter/@azure-tools/typespec-azure-core/composition-over-inheritance | 🟢 0.1ms | 🟢 0.2ms | +29.1% |
| ↳ linter/@azure-tools/typespec-azure-core/documentation-required | 🟢 1.6ms | 🟢 2.0ms | +26.7% |
| ↳ linter/@azure-tools/typespec-azure-core/friendly-name | 🟢 1.1ms | 🟢 1.4ms | +27.8% |
| ↳ linter/@azure-tools/typespec-azure-core/key-visibility-required | 🟢 0.3ms | 🟢 0.4ms | +27.6% |
| ↳ linter/@azure-tools/typespec-azure-core/known-encoding | 🟢 0.4ms | 🟢 0.5ms | +25.0% |
| ↳ linter/@azure-tools/typespec-azure-core/long-running-polling-operation-required | 🟢 0.6ms | 🟢 0.8ms | +29.8% |
| ↳ linter/@azure-tools/typespec-azure-core/no-case-mismatch | 🟢 0.6ms | 🟢 0.7ms | +28.7% |
| ↳ linter/@azure-tools/typespec-azure-core/no-closed-literal-union | 🟢 0.8ms | 🟢 1.0ms | +32.0% |
| ↳ linter/@azure-tools/typespec-azure-core/no-enum | 🟢 0.2ms | 🟢 0.3ms | +40.2% |
| ↳ linter/@azure-tools/typespec-azure-core/no-error-status-codes | 🟢 0.2ms | 🟢 0.3ms | +29.8% |
| ↳ linter/@azure-tools/typespec-azure-core/no-explicit-routes-resource-ops | 🟢 0.1ms | 🟢 0.2ms | +23.3% |
| ↳ linter/@azure-tools/typespec-azure-core/no-format | 🟢 0.7ms | 🟢 0.8ms | +16.0% |
| ↳ linter/@azure-tools/typespec-azure-core/no-generic-numeric | 🟢 0.7ms | 🟢 0.9ms | +22.6% |
| ↳ linter/@azure-tools/typespec-azure-core/no-header-explode | 🔴 23.6ms | 🔴 28.2ms | +19.7% 🔴 |
| ↳ linter/@azure-tools/typespec-azure-core/no-legacy-usage | 🟢 1.7ms | 🟢 2.1ms | +25.7% |
| ↳ linter/@azure-tools/typespec-azure-core/no-multiple-discriminator | 🟢 0.2ms | 🟢 0.2ms | +37.3% |
| ↳ linter/@azure-tools/typespec-azure-core/no-nullable | 🟢 0.4ms | 🟢 0.4ms | +23.4% |
| ↳ linter/@azure-tools/typespec-azure-core/no-offsetdatetime | 🟢 1.7ms | 🟢 2.1ms | +22.3% |
| ↳ linter/@azure-tools/typespec-azure-core/no-openapi | 🟢 2.2ms | 🟢 2.4ms | +8.0% |
| ↳ linter/@azure-tools/typespec-azure-core/no-private-usage | 🟢 2.7ms | 🟢 3.3ms | +23.2% |
| ↳ linter/@azure-tools/typespec-azure-core/no-query-explode | 🔴 24.7ms | 🔴 29.4ms | +19.0% 🔴 |
| ↳ linter/@azure-tools/typespec-azure-core/no-response-body | 🔴 29.6ms | 🔴 35.2ms | +18.9% 🔴 |
| ↳ linter/@azure-tools/typespec-azure-core/no-rest-library-interfaces | 🟢 0.1ms | 🟢 0.1ms | +47.4% |
| ↳ linter/@azure-tools/typespec-azure-core/no-route-parameter-name-mismatch | 🟢 6.7ms | 🟢 8.1ms | +21.5% 🔴 |
| ↳ linter/@azure-tools/typespec-azure-core/no-rpc-path-params | 🟢 0.3ms | 🟢 0.4ms | +28.1% |
| ↳ linter/@azure-tools/typespec-azure-core/no-string-discriminator | 🟢 0.1ms | 🟢 0.2ms | +38.2% |
| ↳ linter/@azure-tools/typespec-azure-core/no-unknown | 🟢 0.3ms | 🟢 0.4ms | +27.1% |
| ↳ linter/@azure-tools/typespec-azure-core/no-unnamed-union | 🟢 0.6ms | 🟢 0.8ms | +24.7% |
| ↳ linter/@azure-tools/typespec-azure-core/operation-missing-api-version | 🟢 0.3ms | 🟢 0.4ms | +21.4% |
| ↳ linter/@azure-tools/typespec-azure-core/request-body-problem | 🟢 0.4ms | 🟢 0.5ms | +17.1% |
| ↳ linter/@azure-tools/typespec-azure-core/require-versioned | 🟢 0.0ms | 🟢 0.1ms | +46.5% |
| ↳ linter/@azure-tools/typespec-azure-core/response-schema-problem | 🔴 28.6ms | 🔴 34.4ms | +20.2% 🔴 |
| ↳ linter/@azure-tools/typespec-azure-core/rpc-operation-request-body | 🟢 0.6ms | 🟢 0.7ms | +28.0% |
| ↳ linter/@azure-tools/typespec-azure-core/spread-discriminated-model | 🟢 0.4ms | 🟢 0.5ms | +22.0% |
| ↳ linter/@azure-tools/typespec-azure-core/use-standard-names | 🟢 6.7ms | 🟢 8.0ms | +18.4% 🔴 |
| ↳ linter/@azure-tools/typespec-azure-core/use-standard-operations | 🟢 0.2ms | 🟢 0.3ms | +24.3% |
| ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-agent-base-type-child-resources | 🟡 15.3ms | 🔴 21.7ms | +41.8% 🔴 |
| ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-agent-base-type-lifecycle-operations | 🟢 0.2ms | 🟢 0.3ms | +46.4% |
| ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-common-types-version | 🟢 9.5ms | 🟡 12.6ms | +32.9% 🔴 |
| ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-custom-resource-no-key | 🟢 0.2ms | 🟢 0.2ms | +36.7% |
| ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-custom-resource-usage-discourage | 🟢 0.1ms | 🟢 0.1ms | +26.8% |
| ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes | 🟢 4.4ms | 🟢 4.5ms | +2.7% |
| ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-no-path-casing-conflicts | 🟡 13.9ms | 🟡 17.5ms | +25.6% 🔴 |
| ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-no-record | 🟢 0.5ms | 🟢 0.7ms | +21.9% |
| ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-post-operation-response-codes | 🟢 1.2ms | 🟢 1.4ms | +21.4% |
| ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-put-operation-response-codes | 🟢 0.2ms | 🟢 0.2ms | +33.3% |
| ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-action-no-segment | 🟢 0.4ms | 🟢 0.5ms | +27.0% |
| ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-duplicate-property | 🟢 0.3ms | 🟢 0.4ms | +36.2% |
| ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-interface-requires-decorator | 🟢 0.1ms | 🟢 0.1ms | +39.9% |
| ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-action-verb | 🟢 0.1ms | 🟢 0.2ms | +27.2% |
| ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property | 🟢 0.2ms | 🟢 0.3ms | +37.0% |
| ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-version-format | 🟢 0.2ms | 🟢 0.2ms | +32.4% |
| ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-key-invalid-chars | 🟢 0.4ms | 🟢 0.5ms | +31.6% |
| ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-name-pattern | 🟢 0.1ms | 🟢 0.1ms | +39.8% |
| ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-operation | 🟢 0.4ms | 🟢 0.6ms | +36.8% |
| ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-operation-response | 🟢 7.5ms | 🟢 9.5ms | +26.8% 🔴 |
| ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-patch | 🟢 0.7ms | 🟢 0.9ms | +34.9% |
| ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-path-segment-invalid-chars | 🟢 0.3ms | 🟢 0.4ms | +26.0% |
| ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-provisioning-state | 🟢 0.3ms | 🟢 0.5ms | +39.5% |
| ↳ linter/@azure-tools/typespec-azure-resource-manager/beyond-nesting-levels | 🟢 0.2ms | 🟢 0.2ms | +36.8% |
| ↳ linter/@azure-tools/typespec-azure-resource-manager/empty-updateable-properties | 🟢 0.3ms | 🟢 0.4ms | +36.6% |
| ↳ linter/@azure-tools/typespec-azure-resource-manager/improper-subscription-list-operation | 🟢 0.1ms | 🟢 0.1ms | +52.8% |
| ↳ linter/@azure-tools/typespec-azure-resource-manager/lro-location-header | 🟡 17.2ms | 🔴 20.9ms | +21.7% 🔴 |
| ↳ linter/@azure-tools/typespec-azure-resource-manager/missing-operations-endpoint | 🟢 0.1ms | 🟢 0.2ms | +45.4% |
| ↳ linter/@azure-tools/typespec-azure-resource-manager/missing-x-ms-identifiers | 🟢 0.8ms | 🟢 1.0ms | +29.3% |
| ↳ linter/@azure-tools/typespec-azure-resource-manager/no-empty-model | 🟢 0.2ms | 🟢 0.3ms | +31.3% |
| ↳ linter/@azure-tools/typespec-azure-resource-manager/no-override-props | 🟢 0.2ms | 🟢 0.3ms | +36.5% |
| ↳ linter/@azure-tools/typespec-azure-resource-manager/no-resource-delete-operation | 🟢 0.4ms | 🟢 0.5ms | +36.5% |
| ↳ linter/@azure-tools/typespec-azure-resource-manager/no-response-body | 🔴 25.9ms | 🔴 32.0ms | +23.6% 🔴 |
| ↳ linter/@azure-tools/typespec-azure-resource-manager/patch-envelope | 🟢 0.3ms | 🟢 0.4ms | +34.0% |
| ↳ linter/@azure-tools/typespec-azure-resource-manager/resource-name | 🟢 0.3ms | 🟢 0.5ms | +31.2% |
| ↳ linter/@azure-tools/typespec-azure-resource-manager/secret-prop | 🟢 4.6ms | 🟢 5.4ms | +16.4% |
| ↳ linter/@azure-tools/typespec-azure-resource-manager/unsupported-type | 🟢 0.6ms | 🟢 0.7ms | +19.4% |
| ↳ linter/@azure-tools/typespec-azure-resource-manager/version-progression | 🟢 0.2ms | 🟢 0.3ms | +37.4% |
| ↳ linter/@azure-tools/typespec-client-generator-core/property-name-conflict | 🟢 1.9ms | 🟢 2.4ms | +25.3% |
| ↳ linter/@azure-tools/typespec-client-generator-core/require-client-suffix | 🟢 1.2ms | 🟢 1.7ms | +43.2% |
| emit | 🔴 5.71s | 🔴 6.31s | +10.5% 🔴 |
| ↳ emit/@Azure-Tools | 🟢 0.0ms | 🟢 0.0ms | +0.0% |
| ↳ emit/@azure-tools/typespec-autorest | 🟢 108.7ms | 🟢 131.1ms | +20.7% 🔴 |
| ↳ emit/@azure-tools/typespec-python | 🔴 2.15s | 🔴 2.36s | +9.5% 🔴 |
| ↳ emit/@typespec | 🟢 0.0ms | 🟢 0.0ms | +0.0% |
| ↳ emit/@typespec/http-client-js | 🔴 521.8ms | 🔴 591.1ms | +13.3% 🔴 |
| ↳ emit/@typespec/openapi3 | 🟢 94.8ms | 🟢 112.4ms | +18.6% 🔴 |
| ↳ emit/@typespec/openapi3/compute | 🟢 82.5ms | 🟢 97.6ms | +18.3% 🔴 |
| ↳ emit/@typespec/openapi3/write | 🟢 12.2ms | 🟢 14.5ms | +19.3% 🔴 |
Averaged across 3 specs (azure-arm-resource-manager, azure-core-dataplane, azure-full).
Threshold: changes > ±5% are highlighted.
🟢 Fast · 🟡 Moderate (stages >200ms, rules >10ms) · 🔴 Slow (stages >400ms, rules >20ms)
Ignore upstream-synced tsp specs, hand-written tests and patches; add 'devcenter' to the dictionary. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
You can try these changes here
|
commit: |
Co-locate with Build-TypeSpec.ps1 and drop the now single-file eng/ directory. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
It only aliased ./Build-TypeSpec.ps1, which CI and Setup.ps1 already call directly. CONTRIBUTING now references the script directly. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Restore #4591's chronus entry (the original move), and change our entry from a 'feature' add to an 'internal' note describing the flatten + autorest cleanup. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Match typespec-python and the repo's Node 22 baseline. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
| "@azure-rest/core-client": ^2.3.1 | ||
| "@azure-tools/codegen": ~2.10.1 | ||
| "@azure-tools/openai-typespec": "1.11.0" | ||
| "@azure-tools/typespec-liftr-base": "0.14.0" | ||
| "@azure-tools/typespec-liftr-base": ">=0.14.0 <1.0.0" |
There was a problem hiding this comment.
is this one also necessary?
There was a problem hiding this comment.
currently yes. when we do tsp-client generate-config-files in SDK repository, it takes emitter's package.json as argument, hence we need its(along with openai-typespec) appearance.
quick question: for versions in catalog, who's able to update them?
| - "@azure-tools/typespec-java" | ||
| --- | ||
|
|
||
| [Java] Flatten the `typespec-java` emitter folder structure and clean up autorest.java-specific tooling. |
There was a problem hiding this comment.
doesn't matter because its internal but you shouldn't add the package in the scope here or it will get included in the changelog for that package
There was a problem hiding this comment.
could you elaborate? I've tried to remove the package, CI will complain: https://github.com/Azure/typespec-azure/actions/runs/28504252500/job/84488633473?pr=4721
or other than adding new one here, I should update existing one Srikanta added instead?
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
| "js-yaml": "catalog:", | ||
| "lodash": "catalog:" | ||
| "lodash": "catalog:", | ||
| "yaml": "catalog:" |
There was a problem hiding this comment.
This is preparation for future microsoft/typespec switch of js-yaml.
Otherwise, typespec-azure integration would fail there: https://github.com/microsoft/typespec/actions/runs/28558818690/job/84672023268?pr=11134
| @@ -157,7 +153,7 @@ catalog: | |||
| happy-dom: ^20.9.0 | |||
| hast-util-to-html: ^9.0.5 | |||
| is-unicode-supported: ^2.1.0 | |||
| js-yaml: ~4.1.1 | |||
| js-yaml: ^4.2.0 | |||
There was a problem hiding this comment.
do we still need that now that you migrated?
There was a problem hiding this comment.
we still need js-yaml before we actually replaced js-yaml in core(microsoft/typespec): microsoft/typespec#11134
also, that PR needs the new yaml be in main, otherwise would fail typespec-azure integration CI..
our http-client-java on main uses ^4.2.0. align it here for now.
There was a problem hiding this comment.
One note: our Java generator depends on snakeyaml, which conforms to YAML-1.1 (same as original js-yaml) and handles serialization/deserialization slightly differently than YAML-1.2. I force using 1.1 syntax there: https://github.com/microsoft/typespec/pull/11134/changes#diff-9b551a4702889299c21829d1d75dd091223f39e6a5ae14e3bda4b4fcc887bbf6R83
Alternative be using snakeyaml-engine which is YAML-1.2 compatible. But it may involve way more code change.
There was a problem hiding this comment.
is it because you are coping the sources?
also, that PR needs the new yaml be in main, otherwise would fail typespec-azure integration CI..
that is fine, that check can fail if you are ready to fix the upstream part quickly after, it is not required and is more of a oh you are breaking typespec-azure make sure you have a pr ready to fix it
There was a problem hiding this comment.
fine anyway for now if you want to merge like that
… publish pipeline - install.yml: add JavaToolInstaller@0 (JDK 11) so the repo-wide pnpm build can build typespec-java's Maven jar - build-for-publish.yml: drop redundant turbo dependency build; pass -SkipBuild to Generate.ps1 to avoid a second jar build - Setup.ps1/Generate.ps1: thread -SkipBuild (pack-only) and drop dead RebuildJar param Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…c_java # Conflicts: # eng/pipelines/templates/install.yml # eslint.config.js # pnpm-lock.yaml # pnpm-workspace.yaml
Summary
Builds on top of #4591 (which moved
@azure-tools/typespec-javainto this repo). This PR overrides that structure with the source-copy approach (onlyoptions.tsis authored here; the rest is copied fromcore/at build time), flattens the package layout, and removes autorest.java-specific tooling.Layout (
packages/typespec-java/)@azure-tools/typespec-javapackage. Onlysrc/options.tsis committed; the rest of the emitter TS is copied fromcore/at build time (Copy-Sources.ps1).Build-TypeSpec.ps1appliescore.patch(Azure customization), buildsemitter.jarfrom core, then packs.emitter-tests/— standalone npm + Maven Spector suite (excluded from the pnpm workspace; consumes the packed.tgz). Hand-written JUnit +tsp/specs synced from core viaSyncTests.ps1;customization/is hand-maintained.docs/— developer/user docs ported from [Java] Move@azure-tools/typespec-javatotypespec-azurerepo #4591.Key points
workspace:^(in-repo/core deps) andcatalog:(external), like the other emitters.mise.tomlusesmicrosoft-11+maven 3.9.16..github/workflows/ci-java.ymlbuilds + runs unit and Spector tests;nightly-e2e.ymladds a Java matrix entry; ADObuild-for-publish.ymlwires Spector coverage upload.post-publish-sdk.yaml/sync_sdk.py/ patches will live in the SDK repo instead.